package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name="杂耍百式",upAbility = 10,needTravel = 2000)
@Order(1005)
@Component
public class ZaShuaBaiShi extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;
    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;
        if (first.getBattleInfo().getAtk() >= first.getBattleInfo().getSpell()) {
            int orgAtk = first.getBattleInfo().getAtk();
            int def = second.getBattleInfo().getDef();
            int atk = (int)(orgAtk * 1.1);
            dmg = battleHelper.calAtk(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("黑虎掏心", "千年杀","观音坐莲","二踢脚","猴子偷桃","龙爪手","拔刀斩","刺字剑"));
        } else {
            int orgAtk = first.getBattleInfo().getSpell();
            int def = second.getBattleInfo().getRes();
            int atk = (int)(orgAtk * 1.1);
            dmg = battleHelper.calSpell(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("急冻术", "燃火术","雷电引","气功波","穿心箭"));
        }
        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
    }
    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return "学习将提升大量道行,自适应攻击,自己何种攻击强大用何种攻击，集成了数种攻击方式但是相差不大,造成1.1倍的术法/物理攻击";
    }


}
